package cn.edu.glut.vo;

import java.util.List;

import org.springframework.data.domain.Page;

/**
 * 
 * @author Caizhfy
 * @version v.0.1
 * @createTime 2017年12月14日下午12:40:01
 * @email Caizhfy@163.com
 * @description 基于SpringPage封装自己的PageDTO,已过时不使用
 *
 */
@Deprecated
public class PageVO{
		
	private int number;					//当前为第number页	
	private int size;					//每页的大小	
	private int numberOfElements;		//当前页有多少个元素	
	private List content;			//具体对象列表	
	private boolean hasContent;			//是否有内容
	private boolean first;			//是否第一页	
	private boolean last;				//是否最后一页	
	private boolean hasNext;			//是否还有下一页	
	private boolean hasPrevious;		//前面是否有数据 
	private int totalPages;				//总页数	
	private long totalElements;			//总共有多少个元素	
	
	
	public PageVO(Page page, List list) {
		super();
		this.number = page.getNumber();
		this.size = page.getSize();
		this.numberOfElements = page.getNumberOfElements();
		this.hasContent = page.hasContent();
		this.first = page.isFirst();
		this.last = page.isLast();
		this.hasNext = page.hasNext();
		this.hasPrevious = page.hasPrevious();
		this.totalPages = page.getTotalPages();
		this.totalElements = page.getTotalElements();
		this.content = list;
	}
	
	public static PageVO convertPage(ConvertPageToPageVO cppv, Page<?> page){
		return cppv.convert(page);
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public int getNumberOfElements() {
		return numberOfElements;
	}

	public void setNumberOfElements(int numberOfElements) {
		this.numberOfElements = numberOfElements;
	}

	public List getContent() {
		return content;
	}

	public void setContent(List content) {
		this.content = content;
	}

	public boolean isHasContent() {
		return hasContent;
	}

	public void setHasContent(boolean hasContent) {
		this.hasContent = hasContent;
	}

	public boolean isFirst() {
		return first;
	}

	public void setFirst(boolean first) {
		this.first = first;
	}

	public boolean isLast() {
		return last;
	}

	public void setLast(boolean last) {
		this.last = last;
	}

	public boolean isHasNext() {
		return hasNext;
	}

	public void setHasNext(boolean hasNext) {
		this.hasNext = hasNext;
	}

	public boolean isHasPrevious() {
		return hasPrevious;
	}

	public void setHasPrevious(boolean hasPrevious) {
		this.hasPrevious = hasPrevious;
	}

	public int getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	public long getTotalElements() {
		return totalElements;
	}

	public void setTotalElements(long totalElements) {
		this.totalElements = totalElements;
	}
	
	
	
}
